@echo off
echo Starting Windows Authentication Service...
echo.

REM 检查Java版本
java -version >nul 2>&1
if %errorlevel% neq 0 (
    echo Error: Java is not installed or not in PATH
    echo Please install Java 11 or higher
    pause
    exit /b 1
)

REM 检查Maven
mvn -version >nul 2>&1
if %errorlevel% neq 0 (
    echo Error: Maven is not installed or not in PATH
    echo Please install Maven 3.6 or higher
    pause
    exit /b 1
)

REM 创建日志目录
if not exist "logs" mkdir logs

REM 编译项目
echo Compiling project...
mvn clean compile
if %errorlevel% neq 0 (
    echo Error: Failed to compile project
    pause
    exit /b 1
)

REM 启动应用程序
echo Starting application on port 8080...
echo Access the application at: http://localhost:8080
echo Press Ctrl+C to stop the application
echo.

mvn exec:java -Dexec.mainClass="io.vertx.core.Launcher" -Dexec.args="run com.example.auth.MainVerticle"

pause